import {JaCoCoParser} from './parsers/jacoco'


export type CoverageRate = {
  lineCoverageRate?: number,
  branchCoverageRate?: number,
  methodCoverageRate?: number,
  classCoverageRate?: number,
  instructionCoverageRate?: number
}

export interface CoverageParser {
  parse(path: string): Promise<CoverageRate>
}

export function getParser(reporter: string): CoverageParser {
  switch (reporter) {
    case 'JaCoCo':
      return new JaCoCoParser();
    default:
      throw new Error(`Input variable 'reporter' is set to invalid value '${reporter}'`)
  }
}